package com.peak.gateway.netty;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;

import java.net.InetSocketAddress;

/**
 * @author likai
 * @date 2021/2/20 16:09
 * @email likai9376@163.com
 * @desc
 */
public class NettyTcp {

    public static void main(String[] args) throws InterruptedException {
        ServerBootstrap serverBootstrap = new ServerBootstrap()
                .option(ChannelOption.SO_REUSEADDR, true)
                .childOption(ChannelOption.AUTO_READ, false)
                .childOption(ChannelOption.TCP_NODELAY, true)
                .localAddress(new InetSocketAddress(0));

        Channel channel = serverBootstrap.bind(8081).sync().channel();
        channel.close().sync();
    }
}
